﻿using System;
using System.Collections.Generic;
using System.Text;
using XDesigner.ORM;

namespace XDesigner.ORM.Test
{
    [Serializable()]
    [ORMType("Employees")]
    [System.ComponentModel.TypeConverter(typeof(MyTypeConverter))]
    public class EmployeeClass
    {
        private int _EmployeeID = 0;
        [ORMKeyField()]
        public int EmployeeID
        {
            get { return _EmployeeID; }
            set { _EmployeeID = value; }
        }

        private string _LastName = null;

        public string LastName
        {
            get { return _LastName; }
            set { _LastName = value; }
        }

        private string _FirstName = null;

        public string FirstName
        {
            get { return _FirstName; }
            set { _FirstName = value; }
        }

        private string _Title = null;

        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }

        private string _TitleOfCourtesy = null;

        public string TitleOfCourtesy
        {
            get { return _TitleOfCourtesy; }
            set { _TitleOfCourtesy = value; }
        }

        private DateTime _BirthDate = DateTime.MinValue ;

        public DateTime BirthDate
        {
            get { return _BirthDate; }
            set { _BirthDate = value; }
        }

        private DateTime _HireDate = DateTime.MinValue;

        public DateTime HireDate
        {
            get { return _HireDate; }
            set { _HireDate = value; }
        }

        private string _Address = null;

        public string Address
        {
            get { return _Address; }
            set { _Address = value; }
        }

        private string _City = null;

        public string City
        {
            get { return _City; }
            set { _City = value; }
        }

        private string _Region = null;

        public string Region
        {
            get { return _Region; }
            set { _Region = value; }
        }

        private string _PostalCode = null;

        public string PostalCode
        {
            get { return _PostalCode; }
            set { _PostalCode = value; }
        }

        private string _Country = null;

        public string Country
        {
            get { return _Country; }
            set { _Country = value; }
        }

        private string _HomePhone = null;

        public string HomePhone
        {
            get { return _HomePhone; }
            set { _HomePhone = value; }
        }

        private string _Extension = null;

        public string Extension
        {
            get { return _Extension; }
            set { _Extension = value; }
        }

        private string _Notes = null;

        public string Notes
        {
            get { return _Notes; }
            set { _Notes = value; }
        }

        private int _ReportsTo = 0;

        public int ReportsTo
        {
            get { return _ReportsTo; }
            set { _ReportsTo = value; }
        }

        private int _Sex = 0;
        //[ORMDictionaryItem("Man" , 1)]
        //[ORMDictionaryItem("Female" , 0)]
        public int Sex
        {
            get { return _Sex; }
            set { _Sex = value; }
        }

        private int _EducationalLevel = 0;

        public int EducationalLevel
        {
            get { return _EducationalLevel; }
            set { _EducationalLevel = value; }
        }

        private string _EMail = null;

        public string EMail
        {
            get { return _EMail; }
            set { _EMail = value; }
        }

        private string _HomePage = null;

        public string HomePage
        {
            get { return _HomePage; }
            set { _HomePage = value; }
        }

        private int _Goal = 0;

        public int Goal
        {
            get { return _Goal; }
            set { _Goal = value; }
        }

        private List<OrderClass> _Orders = null;
        [ORMRelation(ORMRelationStyle.OneToMany, "EmployeeID",UniteDeleteForDelete=true)]
        [ORMDelay()]
        public virtual List<OrderClass> Orders
        {
            get { return _Orders; }
            set { _Orders = value; }
        }

        public override string ToString()
        {
            return "Employee:" + this.LastName + this.FirstName;
        }
    }
}
